package com.stylefeng.guns.rest.modular.vo;

public class ReponseVo<M> {
    //返回状态 0成功 1失败 999系统异常
    private int status;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public M getData() {
        return data;
    }

    public void setData(M data) {
        this.data = data;
    }

    //返回信息
    private String msg;
    //返回数据实体
    private M data;

    public String getImgPre() {
        return imgPre;
    }

    public void setImgPre(String imgPre) {
        this.imgPre = imgPre;
    }

    //图片前缀
    private String imgPre;

    private int nowPage;

    public int getNowPage() {
        return nowPage;
    }

    public void setNowPage(int nowPage) {
        this.nowPage = nowPage;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    private int totalPage;

    private ReponseVo() {
    }

    public static <M> ReponseVo success(int nowPage, int totalPage, String imgPre, M m) {
        ReponseVo reponseVo = new ReponseVo();
        reponseVo.setStatus(0);
        reponseVo.setData(m);
        reponseVo.setImgPre(imgPre);
        reponseVo.setNowPage(nowPage);
        reponseVo.setTotalPage(totalPage);
        return reponseVo;
    }

    public static <M> ReponseVo success(M m) {
        ReponseVo reponseVo = new ReponseVo();
        reponseVo.setStatus(0);
        reponseVo.setData(m);
        return reponseVo;
    }

    public static <M> ReponseVo success(String imgPre, M m) {
        ReponseVo reponseVo = new ReponseVo();
        reponseVo.setStatus(0);
        reponseVo.setData(m);
        reponseVo.setImgPre(imgPre);
        return reponseVo;
    }

    public static <M> ReponseVo success(String msg) {
        ReponseVo reponseVo = new ReponseVo();
        reponseVo.setStatus(0);
        reponseVo.setMsg(msg);
        return reponseVo;
    }

    public static <M> ReponseVo serviceFail(String msg) {
        ReponseVo reponseVo = new ReponseVo();
        reponseVo.setStatus(1);
        reponseVo.setMsg(msg);
        return reponseVo;
    }

    public static <M> ReponseVo appFail(String msg) {
        ReponseVo reponseVo = new ReponseVo();
        reponseVo.setStatus(999);
        reponseVo.setMsg(msg);
        return reponseVo;
    }
}
